<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="JinYan&#39;s blog">
  <meta name="keyword" content="hexo-theme, vuejs">
  
    <link rel="shortcut icon" href="/blog/css/images/logo.jpg">
  
  <title>
    
      girllove.sh | SanYuanEmpire
    
  </title>
  <link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="//cdn.bootcss.com/highlight.js/9.12.0/styles/tomorrow.min.css" rel="stylesheet">
  <link rel="stylesheet" href="/blog/css/style.css">
<link rel="stylesheet" href="/blog/css/plugins/gitment.css">
  <script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script src="//cdn.bootcss.com/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script>
  <script src="/blog/js/qrious.js"></script>
<script src="/blog/js/gitment.js"></script>
  
  
    <!-- MathJax support START -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <!-- MathJax support END -->
  


</head>
<div class="wechat-share">
  <img src="/css/images/logo.jpg" />
</div>

  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/blog/">
      <div class="logo"></div>
      <span>SanYuanEmpire</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/blog/" class="item-link">Home</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/blog/archives/" class="item-link">Archives</a>
          
        </li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/blog/" class="menu-link">Home</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/blog/archives/" class="menu-link">Archives</a>
            
          </li>
        
      </ul>
    </div>
  </div>
</header>

    <div id="article-banner">
  <h2>girllove.sh</h2>
  <p class="post-date">2018-09-06</p>
  <div class="arrow-down">
    <a href="javascript:;"></a>
  </div>
</div>
<main class="app-body flex-box">
  <!-- Article START -->
  <article class="post-article">
    <section class="markdown-content"><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br></pre></td><td class="code"><pre><span class="line">girlLlove 脚本可以展示如下几个部分：文字特效（poetry），问题（question），问题选项（bakans），答案（answer）和提示（tips）。这些内容都保存在 shell 数组(girlLove.txt 文件) 中，并且是一一对应的关系，在主程序 girlLove.sh 中通过 while 循环一个一个的展示出来。以上各部分的具体内容都可以在 girlLove.txt 文件中设定，设定的选项数量和用户的屏幕相关，如果读者显示屏幕过小，则选项数量多了有可能产生位置偏移等影响。</span><br><span class="line">19.2.2 使用方法</span><br><span class="line">p 388</span><br><span class="line">[root@www ~]# tar xf girlLove.tar.gz #&lt;== 获取到工具软件包，解压。</span><br><span class="line">[root@www ~]# cd girlLove/</span><br><span class="line">[root@ girlLove]# tree</span><br><span class="line">.</span><br><span class="line">├── girlLove.sh #&lt;== 实现脚本</span><br><span class="line">└── girlLove.txt #&lt;== 特效及问答模板</span><br><span class="line">0 directories, 2 files</span><br><span class="line">[root@www girlLove]# sh girlLove.sh lili #&lt;== 结果展示见下文。</span><br><span class="line">提示：解压之后，也可以编辑 girlLove.txt 设置自己的问题，问题选项，答案和提示，注意 girlLove.txt 内容的字符串格式，也需要有语法的。</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">19.2.3 girlLove工具内容模板</span><br><span class="line">p 388</span><br><span class="line">提示：只需修改这个文件就可以为己所用了！</span><br><span class="line">   这部分内容以 girlLove.txt 文件呈现，本质上这个文件也是一个 shell 脚本，因此读者改动时请注意格式，下面是 girlLove.txt 文件内容展现。</span><br><span class="line">老男孩追求女朋友问答模板 (已经经过实战了的，很有效呦！)</span><br><span class="line">#老男孩追求女朋友的浪漫模板</span><br><span class="line">#文字特效（poetrys）</span><br><span class="line">poetrys=(</span><br><span class="line">&quot; &quot; \</span><br><span class="line">&quot; ㊣━━^-^o 中华人民共和国 o^-^━━㊣ &quot; \</span><br><span class="line">&quot;┃ 谨祝: 　 ┃ &quot; \</span><br><span class="line">&quot;┃ $name 小盆友 天天开心! ┃ &quot; \</span><br><span class="line">&quot;┃ 　　　 老男孩 颁 ┃&quot;\</span><br><span class="line">&quot; ㊣━━^-^o 中华人民共和国 o^-^━━㊣ &quot; \</span><br><span class="line">&quot; &quot; \</span><br><span class="line">&quot; 嘟嘟 oοО○●哇靠！！！快让开】&quot; \</span><br><span class="line">&quot; 　╭══╮亲亲！开车罗 \` 坐好啊 &quot; \</span><br><span class="line">&quot;　╭╯五档║老公！开慢点 \` 我兴奋　 &quot; \</span><br><span class="line">&quot;　╰⊙═⊙╯。oо○ 轧死了不赔！&quot; )</span><br><span class="line">#问题集合（question）</span><br><span class="line">questions=( </span><br><span class="line">&quot;1、坐在你旁边的是你什么人？&quot; \</span><br><span class="line">&quot;2、你男朋友老家是哪个地方的？&quot; \</span><br><span class="line">&quot;3、你男朋友会做下列哪种饭？&quot; \</span><br><span class="line">&quot;4、丽丽最爱看下列哪一个电视剧？&quot; \</span><br><span class="line">&quot;5、你男朋友最喜欢吃什么？&quot; \</span><br><span class="line">&quot;6、你男朋友休闲的时候最喜欢干什么？&quot;\</span><br><span class="line">&quot;7、休闲时你最喜欢他陪你做什么 &quot; \</span><br><span class="line">&quot;8、今年的生日礼物你最想要啥？&quot; \</span><br><span class="line">&quot;9、你计划啥时候和他一起领证？&quot; \</span><br><span class="line">&quot;10、领证后你想去哪度蜜月？&quot; \</span><br><span class="line">&quot;11、结婚后，你希望财务归谁管？（最后一道题了）&quot;)</span><br><span class="line">#问题选项（bakans）</span><br><span class="line">bakans=( </span><br><span class="line">&quot;A. 男朋友 B. 普通朋友 C. 男闺蜜 D. 以上都不是 &quot; \</span><br><span class="line">&quot;A. 铁岭 B. 沈阳 C. 四平 D. 以上都不是 &quot; \</span><br><span class="line">&quot;A. 蛋炒饭 B. 鸡蛋羹 C. 煮米饭 D. 以上都是 &quot; \</span><br><span class="line">&quot;A. 电视剧 B. 电影 C. 话剧 D. 二人转 &quot; \</span><br><span class="line">&quot;A. 大葱 B. 白菜 C. 排骨 D. 辣椒 &quot; \</span><br><span class="line">&quot;A. 打台球 B. 看书 C. 睡觉 D. 听歌 &quot; \</span><br><span class="line">&quot;A. 看电视剧 B. 逛街 C. 旅游 D. 一起起床 &quot; \</span><br><span class="line">&quot;A. 钻戒 B. 手机 C. 包 D. 高跟鞋 &quot; \</span><br><span class="line">&quot;A.6 个月内 B.12 个月内 C.24 个月以内 D. 没想好 &quot; \</span><br><span class="line">&quot;A. 马尔代夫 B. 巴厘岛 C. 海南三亚 D. 去大城市铁岭 &quot; \</span><br><span class="line"> &quot;A. 老公 B. 老婆 C. 共同管理 D. 没想好 &quot;)</span><br><span class="line"> </span><br><span class="line">#问题答案（answers）</span><br><span class="line">answers=(A A A A A A A A A A A)</span><br><span class="line"> </span><br><span class="line">#问题提示 (tips)</span><br><span class="line">tips=(  </span><br><span class="line">&quot;Dear，选 A 啊，妹子啊 555..&quot; \</span><br><span class="line">&quot;Dear，选 A 啊，大城市铁岭，你该知道的！&quot; \</span><br><span class="line">&quot;Dear，选 A 啊，蛋炒饭是老男孩拿手的呦！&quot; \</span><br><span class="line">&quot;Dear，选 A 啊，肯定是电视剧，我比你清楚哦 &quot; \</span><br><span class="line">&quot;Dear，选 A 啊，绝对是大葱，你比我还清楚哦 &quot; \</span><br><span class="line">&quot;Dear，选 A 啊，台球啊，哥打台球时老帅了 &quot; \</span><br><span class="line">&quot;Dear，选 A 啊，我陪你做你最喜欢的...&quot; \</span><br><span class="line">&quot;Dear，选 A 啊，钻戒必须的，而且是 1 克拉的 &quot;\</span><br><span class="line">&quot;Dear，选 A 啊，这么好的男朋友，要抓住啊.&quot; \</span><br><span class="line">&quot;Dear，选 A 啊，马尔代夫不是你的愿望么？&quot; \</span><br><span class="line">&quot;Dear，选 A 啊，老公不但会赚钱，还会理财呦！&quot;)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">19.2.4 girlLove工具的Shell源码注释</span><br><span class="line">p 389</span><br><span class="line">#!/bin/sh</span><br><span class="line"># by oldboy training.</span><br><span class="line"># http://oldboy.blog.51cto.com</span><br><span class="line">girlname=&quot;$1&quot;</span><br><span class="line">pos_stdy=&quot;$(($(stty size|cut -d&apos; &apos;-f1)/3*2))&quot;</span><br><span class="line">pos_stdx=&quot;$(($(stty size|cut -d&apos; &apos;-f2)/2))&quot;</span><br><span class="line">total_stdy=&quot;$(($(stty size|cut -d&apos;&apos; -f1)))&quot;</span><br><span class="line">total_stdx=&quot;$(($(stty size|cut -d&apos;&apos; -f2)))&quot;</span><br><span class="line">logo=&quot; 本节目为北京老男孩 IT 教育出品，祝天下所有有情人钟情眷属！&quot;</span><br><span class="line">good=&quot;$&#123;girlname&#125;, 你太棒了，完美答对！&quot;</span><br><span class="line">decl=&quot; 这辈子最疯狂的事，就是爱上了你，我会好好爱你的，请让我守候你一辈子！&quot;</span><br><span class="line">info=&quot; 亲，$girlname, 这是我送给你的最特别礼物，请选择 A-D 并按下回车开始答题吧.&quot;</span><br><span class="line">head=&quot; 答题进度：&quot;</span><br><span class="line">[-f ./girlLove.txt]||exit 1</span><br><span class="line">. ./girlLove.txt</span><br><span class="line"> </span><br><span class="line">function usage()&#123;</span><br><span class="line">  echo $&quot;Usage:$0 mm_name&quot;</span><br><span class="line">  exit 1</span><br><span class="line">&#125;</span><br><span class="line"> </span><br><span class="line">function start()&#123;</span><br><span class="line"># 设置红色背景</span><br><span class="line">printf &quot;\e[40m&quot;</span><br><span class="line"># 清屏</span><br><span class="line">clear</span><br><span class="line">printf &quot;\r\e[10;30H\E[33m$&#123;logo&#125;\E[0m\n&quot;</span><br><span class="line">sleep 2</span><br><span class="line">printf &quot;\r\e[10;30H\E[33;5m$&#123;logo&#125;\E[0m\n&quot;</span><br><span class="line">sleep 2</span><br><span class="line">printf &quot;\e[40m&quot;</span><br><span class="line">clear</span><br><span class="line">&#125;</span><br><span class="line">function print_xy()&#123;</span><br><span class="line">   if [$# -eq 0]; then</span><br><span class="line">       return 1</span><br><span class="line">   fi</span><br><span class="line"> </span><br><span class="line">   len=32</span><br><span class="line">   </span><br><span class="line">   if [$# -lt 2]; then</span><br><span class="line">     pos=&quot;\e[$&#123;pos_stdy&#125;;$(($&#123;pos_stdx&#125; - $&#123;len&#125;))H&quot;</span><br><span class="line">   fi</span><br><span class="line"> </span><br><span class="line">   case &quot;$2&quot; in</span><br><span class="line">     -)</span><br><span class="line">       pos=&quot;\e[$(($&#123;pos_stdy&#125; - $3));$(($&#123;pos_stdx&#125; - $&#123;len&#125;))H&quot;</span><br><span class="line">       ;;</span><br><span class="line">     +)</span><br><span class="line">       pos=&quot;\e[$(($&#123;pos_stdy&#125; + $3));$(($&#123;pos_stdx&#125; - $&#123;len&#125;))H&quot;</span><br><span class="line">       ;;</span><br><span class="line"> </span><br><span class="line">     lu)</span><br><span class="line">       pos=&quot;\e[$(($&#123;pos_stdy&#125; - $3));$(($&#123;pos_stdx&#125; - $4))H&quot;</span><br><span class="line">       ;;</span><br><span class="line">     ld)</span><br><span class="line">       pos=&quot;\e[$(($&#123;pos_stdy&#125; + $3));$(($&#123;pos_stdx&#125; - $4))H&quot;</span><br><span class="line">   esac</span><br><span class="line">   echo -ne &quot;$&#123;pos&#125;$1&quot;</span><br><span class="line">&#125;</span><br><span class="line">function waiting()&#123;</span><br><span class="line">  local i=1</span><br><span class="line">  # 通过 while 循环实现 /// 转圈的动画效果</span><br><span class="line">  while [$i -gt 0]</span><br><span class="line">  do</span><br><span class="line">       for j in &apos;-&apos; &apos;\\&apos; &apos;|&apos; &apos;/&apos;</span><br><span class="line">       do</span><br><span class="line">            # 打印前面若干个 / 特效符号 + decl 变量中的内容</span><br><span class="line">            echo -ne&quot;\033[1m\033[$pos_stdy;$(($&#123;pos_stdx&#125;/3))H$j$j$j\033[4m\033[32m$&#123;decl&#125;&quot;</span><br><span class="line">            # 打印后面若干个 / 特效符号</span><br><span class="line">            echo -ne&quot;\033[24m\033[?25l$j$j$j&quot;</span><br><span class="line">            # 打印前面若干个 / 特效符号 + good 变量中的内容</span><br><span class="line">            echo -ne &quot;\033[1m\033[$(($pos_stdy-2));$(($&#123;pos_stdx&#125;/3))H$j$j$j\033[4m\033[32m$&#123;good&#125;&quot;</span><br><span class="line">            # 打印后面若干个 / 特效符号</span><br><span class="line">            echo -ne&quot;\033[24m\033[?25l$j$j$j&quot;</span><br><span class="line">            usleep 100000</span><br><span class="line">       done</span><br><span class="line">       ((i++))</span><br><span class="line">   done</span><br><span class="line">&#125;</span><br><span class="line">function print_info()&#123;</span><br><span class="line"># 打印如下字符串（格式化界面）</span><br><span class="line">print_xy&quot;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&amp;*&quot;</span><br><span class="line">print_xy&quot;\E[33m$&#123;info&#125;\E[0m&quot; + 1</span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line">offset=20</span><br><span class="line">seq=0</span><br><span class="line"># 循环问题</span><br><span class="line">while [$&#123;seq&#125; -lt $&#123;#poetrys[@]&#125; ]</span><br><span class="line">do</span><br><span class="line">   sleep 0</span><br><span class="line">   isanswers=0</span><br><span class="line"> </span><br><span class="line">   # 打印问题</span><br><span class="line">   print_xy &quot;$&#123;questions[$seq]&#125;&quot; ld 2 $offset</span><br><span class="line">   print_xy &quot;$&#123;bakans[$seq]&#125;&quot; ld 3 $(($&#123;offset&#125;-2))</span><br><span class="line">   print_xy &quot; 答：&quot; ld 4 $offset</span><br><span class="line"> </span><br><span class="line">   # 读取终端输入到变量 ans</span><br><span class="line">   read ans</span><br><span class="line">   echo -e &quot;\033[3A\r\033[K&quot;</span><br><span class="line">   # 清除问题选项行字符</span><br><span class="line">   echo -e &quot;\033[K&quot;</span><br><span class="line">   # 清除回答栏字符</span><br><span class="line">   echo -e &quot;\033[K&quot;</span><br><span class="line">   # 如果输入的值和预设的答案不同，则继续循环该问题</span><br><span class="line">  if [&quot;$ans&quot; != &quot;$&#123;answers[$seq]&#125;&quot; -a &quot;`echo$ans|tr a-d A-D`&quot; != &quot;$&#123;answers[$seq]&#125;&quot; ]; then</span><br><span class="line"> </span><br><span class="line">       # 打印 -----，格式化界面。----- 下面会显示该问题的 tip</span><br><span class="line">       print_xy&quot;-----------------------------------------------------&quot; + 5</span><br><span class="line"> </span><br><span class="line">       # 显示该问题的 tip</span><br><span class="line">       print_xy &quot;$&#123;tips[$seq]&#125;&quot; + 7</span><br><span class="line">       sleep 3</span><br><span class="line">       # 将光标移到行首，并清除光标到行尾的字符</span><br><span class="line">       echo -e &quot;\r\033[K&quot;</span><br><span class="line">       # 光标上移 3 行，并清除光标到行尾的字符</span><br><span class="line">       echo -e &quot;\033[3A\r\033[K&quot;</span><br><span class="line">       continue</span><br><span class="line">   fi</span><br><span class="line"> </span><br><span class="line">   # 问题序号 + 1</span><br><span class="line">   seq=`expr $&#123;seq&#125; + 1`</span><br><span class="line">   # 获取 poetrys 的倒数第 seq + 1 行</span><br><span class="line">   curseq=`expr $&#123;#poetrys[@]&#125; - $&#123;seq&#125;`</span><br><span class="line">   # 打印 poetrys 的倒数第 seq + 1 行</span><br><span class="line">   print_xy &quot;$&#123;poetrys[$&#123;curseq&#125;]&#125;&quot; lu $seq $offset</span><br><span class="line">   # 打印进度条</span><br><span class="line">   total=$[$&#123;total_stdx&#125; - $&#123;#head&#125;*10]</span><br><span class="line">   per=$[$&#123;seq&#125;*$&#123;total&#125;/$&#123;#poetrys[@]&#125;]</span><br><span class="line">   shengyu=$[$&#123;total&#125; - $&#123;per&#125;]</span><br><span class="line">   printf&quot;\r\e[$&#123;total_stdy&#125;;19H$&#123;head&#125;\e[43m%$&#123;per&#125;s\e[41m%$&#123;shengyu&#125;s\e[00m&quot;&quot;&quot; &quot;&quot;;</span><br><span class="line">done</span><br><span class="line">      printf &quot;\r\e[$(($&#123;total_stdy&#125;));19H \E[33m 恭喜我心中最美的 $&#123;girname&#125; 全部答对 \ E[0m&quot;;</span><br><span class="line"># 设置红色背景</span><br><span class="line">printf &quot;\e[41m&quot;</span><br><span class="line"># 清屏</span><br><span class="line">clear</span><br><span class="line">&#125;</span><br><span class="line"> </span><br><span class="line">function main()&#123;</span><br><span class="line">if [$# -ne 1]; then</span><br><span class="line"> usage</span><br><span class="line">fi</span><br><span class="line">start</span><br><span class="line">clear</span><br><span class="line">print_info</span><br><span class="line">waiting</span><br><span class="line">&#125;</span><br><span class="line">main $*</span><br></pre></td></tr></table></figure>
</section>
    <!-- Tags START -->
    
    <!-- Tags END -->
    <!-- NAV START -->
    
  <div class="nav-container">
    <!-- reverse left and right to put prev and next in a more logic postition -->
    
      <a class="nav-left" href="/blog/2018/09/06/ddos-sh/">
        <span class="nav-arrow">← </span>
        
          ddos.sh
        
      </a>
    
    
      <a class="nav-right" href="/blog/2018/09/06/ids-sh/">
        
          ids.sh
        
        <span class="nav-arrow"> →</span>
      </a>
    
  </div>

    <!-- NAV END -->
    
      <!-- No Comment -->
    
  </article>
  <!-- Article END -->
  <!-- Catalog START -->
  
    <aside class="catalog-container">
  <div class="toc-main">
    <strong class="toc-title">Catalog</strong>
    
      <ol class="nav">none</ol>
    
  </div>
</aside>
  
  <!-- Catalog END -->
</main>

<script>
  (function () {
    var url = 'git@gitee.com:sanyuanempire/blog.git/2018/09/06/girllove-sh/';
    var banner = ''
    if (banner !== '' && banner !== 'undefined' && banner !== 'null') {
      $('#article-banner').css({
        'background-image': 'url(' + banner + ')'
      })
    } else {
      $('#article-banner').geopattern(url)
    }
    $('.header').removeClass('fixed-header')

     // error image
    $(".markdown-content img").on('error', function() {
      $(this).attr('src', 'http://file.muyutech.com/error-img.png')
      $(this).css({
        'cursor': 'default'
      })
    })

    // zoom image
    $(".markdown-content img").on('click', function() {
      var src = $(this).attr('src')
      if (src !== 'http://file.muyutech.com/error-img.png') {
        var imageW = $(this).width()
        var imageH = $(this).height()
        
        var zoom = ($(window).width() * 0.95 / imageW).toFixed(2)
        zoom = zoom < 1 ? 1 : zoom
        zoom = zoom > 2 ? 2 : zoom
        var transY = (($(window).height() - imageH) / 2).toFixed(2)

        $('body').append('<div class="image-view-wrap"><div class="image-view-inner"><img src="'+ src +'" /></div></div>')
        $('.image-view-wrap').addClass('wrap-active')
        $('.image-view-wrap img').css({
          'width': `${imageW}`,
          'transform': `translate3d(0, ${transY}px, 0) scale3d(${zoom}, ${zoom}, 1)`
        })
        $('html').css('overflow', 'hidden')

        $('.image-view-wrap').on('click', function() {
          $(this).remove()
          $('html').attr('style', '')
        })
      }
    })

    // qrcode
    var qr = new QRious({
      element: document.getElementById('share-qrcode'),
      value: document.location.href
    });

    // gitment
    var gitmentConfig = "";
    if (gitmentConfig !== 'undefined') {
      var gitment = new Gitment({
        id: "girllove.sh",
        owner: "",
        repo: "",
        oauth: {
          client_id: "",
          client_secret: ""
        },
        theme: {
          render(state, instance) {
            const container = document.createElement('div')
            container.lang = "en-US"
            container.className = 'gitment-container gitment-root-container'
            container.appendChild(instance.renderHeader(state, instance))
            container.appendChild(instance.renderEditor(state, instance))
            container.appendChild(instance.renderComments(state, instance))
            container.appendChild(instance.renderFooter(state, instance))
            return container;
          }
        }
      })
      gitment.render(document.getElementById('comments'))
    }
  })();
</script>

<script>
  var disqus_shortname = '';
  
  var disqus_url = 'git@gitee.com:sanyuanempire/blog.git/2018/09/06/girllove-sh/';
  
  (function(){
    var dsq = document.createElement('script');
    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//go.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
</script>

    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
  <p class="copyright">
    &copy; 2018 | Proudly powered by <a href="https://sanyuanempire.gitee.io/blog" target="_blank">JinYan</a>
    <br>
    Theme by <a href="https://sanyuanempire.gitee.io/blog">JinYan</a>
  </p>
</footer>

<script>
  function async(u, c) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async("//cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function(){
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async("//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js", function(){
    $('figure pre').each(function(i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>
<!-- Baidu Tongji -->

<script src="/blog/js/script.js"></script>

  </body>
</html>